package com.dingreading.cloud.mall.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 购物车记录
 */
@Data
@Table(value = "shop_cart")
public class ShopCart implements Serializable {

    @Id(keyType = KeyType.Auto)
    private Long id;

    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onInsertValue = "now()")
    private Date addTime;

    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onInsertValue = "now()", onUpdateValue = "now()")
    private Date editTime;

    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    /**
     * 购物车类型 1.购物车 2.立即购买 3.赠品
     */
    @ApiModelProperty(value = "购物车类型")
    private Integer type;

    /**
     * 公司uid
     */
    @ApiModelProperty(value = "公司uid")
    private String corpUid;

    /**
     * 门店uid
     */
    @ApiModelProperty(value = "门店uid")
    private String storeUid;

    /**
     * 员工uid
     */
    @ApiModelProperty(value = "员工uid")
    private String staffUid;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    private String code;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品id")
    private Long goodsId;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    /**
     * 商品分类id
     */
    @ApiModelProperty(value = "商品种类id")
    private Long goodsTypeId;

    /**
     * 商品分类名称
     */
    @ApiModelProperty(value = "商品分类名称")
    private String goodsTypeName;

    /**
     * 封面图
     */
    @ApiModelProperty(value = "封面图")
    private String img;

    /**
     * 是否实体货物
     * 0.不是 1.是
     */
    @ApiModelProperty(value = "是否实体货物 0.不是 1.是")
    private Integer realStatus;

    /**
     * 单位
     */
    @ApiModelProperty(value = "单位")
    private String unit;

    /**
     * 商品单价
     */
    @ApiModelProperty(value = "商品单价")
    private Double unitPrice;

    /**
     * 总价
     */
    @ApiModelProperty(value = "总价")
    private Double price;

    /**
     * 购买数量
     */
    @ApiModelProperty(value = "购买数量")
    private Integer buyNum;

    /**
     * 最低购买数
     */
    @ApiModelProperty(value = "最低购买数")
    private Integer minBuyNum;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private String remark;

    /**
     * 能否使用代金券
     * 0.否 1.能
     */
    @ApiModelProperty(value = "能否使用代金券 0.否 1.能")
    private Integer couponStatus;

    /**
     * 状态
     * -1.已退费 0.取消 1.已付款 2.未付款 3.待付 4.已出库
     */
    @ApiModelProperty(value = "状态")
    private Integer status;

    /**
     * 状态名
     */
    @ApiModelProperty(value = "状态名")
    private String statusName;

    /**
     * 支付时间
     */
    @ApiModelProperty(value = "支付时间")
    private String payTimes;

    /**
     * 出库备注
     */
    @ApiModelProperty(value = "出库备注")
    private String outRemark;

    /**
     * 付款方式 1.不限 2.银行转账
     */
    @ApiModelProperty(value = "付款方式")
    private Integer paymentMethod;

    /**
     * 出库方式 1.自营仓库 2.线上发货 3.第三方仓库
     */
    @ApiModelProperty(value = "出库方式")
    private Integer stockOutMethod;

    /**
     * 创建人uid
     */
    @ApiModelProperty(value = "创建人uid")
    private String addStaffUid;

    /**
     * 创建人姓名
     */
    @ApiModelProperty(value = "创建人姓名")
    private String addStaffName;

    /**
     * 更新人uid
     */
    @ApiModelProperty(value = "更新人uid")
    private String lastStaffUid;

    /**
     * 更新人姓名
     */
    @ApiModelProperty(value = "更新人姓名")
    private String lastStaffName;

    /*------*/
    /**
     * 物车记录uid
     */
    @ApiModelProperty(value = "物车记录uid")
    private String uid;

    /**
     * 商品组合类型 0.普通商品 1.组合商品
     */
    @ApiModelProperty(value = "商品组合类型")
    private Integer comboType;

    /**
     * 父商品组合类型 0.普通商品 1.组合商品
     */
    @ApiModelProperty(value = "组合类型")
    private Integer mainComboType;

    /**
     * 组合商品的父购物车记录uid
     */
    @ApiModelProperty(value = "组合商品的父购物车记录uid")
    private String mainShopCartUid;

    /**
     * 父商品id
     */
    @ApiModelProperty(value = "父商品id")
    private Long mainGoodsId;

    /**
     * 父商品名称
     */
    @ApiModelProperty(value = "父商品名称")
    private String mainGoodsName;

    /**
     * 父商品分类id
     */
    @ApiModelProperty(value = "父商品种类id")
    private Long mainGoodsTypeId;

    /**
     * 父商品分类名称
     */
    @ApiModelProperty(value = "父商品分类名称")
    private String mainGoodsTypeName;

    /**
     * 重量/克
     */
    @ApiModelProperty(value = "重量/克")
    private Double weight;

    /**
     * 总重量/克
     */
    @ApiModelProperty(value = "总重量/克")
    private Double totalWeight;

    /**
     * 包邮模板id
     */
    @ApiModelProperty(value = "包邮模板id")
    @RelationOneToOne(
            selfField = "goodsId",

            targetTable = "free_delivery",
            targetField = "id",
            valueField = "id",

            joinTable = "goods",
            joinSelfColumn = "id",
            joinTargetColumn = "free_delivery_id"
    )
    private Long freeDeliveryId;

    /**
     * 包邮模板名称
     */
    @ApiModelProperty(value = "包邮模板名称")
    @RelationOneToOne(
            selfField = "goodsId",

            targetTable = "free_delivery",
            targetField = "id",
            valueField = "name",

            joinTable = "goods",
            joinSelfColumn = "id",
            joinTargetColumn = "free_delivery_id"
    )
    private String freeDeliveryName;

    /**
     * 能否包邮状态 0.不包邮 1.包邮
     */
    @ApiModelProperty(value = "能否包邮状态")
    private Integer freeDeliveryStatus;

    /**
     * 最初价格
     */
    @ApiModelProperty(value = "最初价格")
    private Double originalPrice;

    /**
     * 最初的单价
     */
    @ApiModelProperty(value = "最初的单价")
    private Double originalUnitPrice;

    /**
     * 折扣率
     */
    @ApiModelProperty(value = "折扣率")
    private Double discountRate;

    /**
     * 折扣金额
     */
    @ApiModelProperty(value = "折扣金额")
    private Double discountPrice;

    /**
     * 抵扣金额
     */
    @ApiModelProperty(value = "抵扣金额")
    private Double deductionPrice;

}
